<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('选择人员')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                工号：<input type="text" name="badge"/>
                            </li>
                            <li>
                                姓名：<input type="text" name="name"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>


<script th:inline="javascript">
    var prefix = ctx + "entryExitManage";
    var type;
    $(function () {
        type = [[${type}]];
        queryCompanyList();
    });



    function queryCompanyList() {
        var options = {
            code: "eid",
            uniqueId: "eid",
            url: prefix + "/getEmpList",
            escape: true,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [{
                radio: true
            },
                {
                    field: 'eid',
                    title: 'eid',
                    visible: false
                },
                {
                    field: 'bgna',
                    title: '用户'
                }]
        };
        $.table.init(options);
    }

    function submitHandler(index, layero) {
        var row = $("#bootstrap-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        var bgna = $.table.selectColumns("bgna");
        var eid = $.table.selectColumns("eid");
        $.modal.close();
        // 父页面的变量
        if(type == "Director"){
            parent.$('#Director').val(eid);
            parent.$('#DirectorName').val(bgna);
        }else if(type == "Director2"){
            parent.$('#Director2').val(eid);
            parent.$('#Director2Name').val(bgna);
        }
    }
</script>
</body>
</html>
